<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
import { getStorage } from './utils/auth'
export default {
  methods: {
    // 初始化数据
    initVuexData(key, commitName) {
      const data = getStorage(key)
      if (data === null) return
      this.$store.commit(commitName, data)
    },
  },
  mounted() {
    // 防止刷新页面，vuex数据丢失
    this.initVuexData('userInfo', 'user/INIT_USERINFO')
    this.initVuexData('pageList', 'labelPage/INIT_PAGE_LIST')
    this.initVuexData('theme', 'theme/INIT_THEME')
  },
}
</script>

<style lang="scss">
// 引入样式
@import './assets/styles/index.scss';

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}

* {
  margin: 0;
  padding: 0;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
}

.el-dialog {
  text-align: left;
}

// 解决级联选择器高度问题
.el-cascader-menu {
  height: 300px !important;
}

.el-cascader {
  width: 100%;
}

.ql-editor {
  min-height: 300px !important;
}
</style>
